package org.tankwar.model;

import org.tankwar.util.GlobalUtil;
import org.tankwar.util.ImageUtil;
import org.tankwar.view.GamePanel;

import java.awt.*;

public class Tree extends StaticGameComponent{

    public Tree(int x, int y, GamePanel tc) { // Tree的构造方法，传递x，y和tc对象
        // 设置树的图片
        componentImage = GlobalUtil.tk.getImage(this.getClass().getResource(ImageUtil.TREE_IMAGE_URL));
        this.x = x;
        this.y = y;
        this.width = 36;
        this.height = 36;
        this.gamePanel = tc;
    }
    @Override
    public void draw(Graphics g) {
        g.drawImage(componentImage, x, y, null);
    }
}
